package com.example.system_backend.service.impl;

import com.example.system_backend.entity.Teeth;
import com.example.system_backend.repository.TeethRepository;
import com.example.system_backend.service.TeethService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeethServiceImpl implements TeethService {

    @Autowired
    private TeethRepository teethRepository;


    @Override
    public List<Teeth> teethListByUser(String userEmail) {
        List<Teeth> teethList = teethRepository.findAllByUserEmail(userEmail);
        return teethList;
    }

    @Override
    public Teeth teethById(Integer id) {
        Teeth teeth = teethRepository.findById(id).get();
        return teeth;
    }

    @Override
    public List<Teeth> teethListByDentist(String dtEmail) {
        List<Teeth> teethList = teethRepository.findAllByDtEmail(dtEmail);
        return teethList;
    }
}
